home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Info-Mac 4
/
Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso
/
Communications
/
General
/
LineShare Folder
/
Put Onto Productions Disks
/
LineShare Scripts
/
Generic Fax2&ARA&Data
< prev
next >
Wrap
Text File
|
1994-03-23
|
7KB
|
326 lines
! Version 2.1
!
!$ Requires: Class 2 fax modem, hardware handshaking cable.
!$ Supports: fax, ARA, and a generic comm. software in the server mode.
!$ Use: Class 2 for Fax, ARA/LineShare for ARA.
!$ Read: your modem manual to modify the "AT" strings.
!$ See: the Generic Scripts Guide for details.
^2 Speaker On: = Enum("Never" = "0" , "When Connecting" = "1", "Always"="2") "1"
^3 Speaker Volume: = Enum("Low"="1","Medium"="2","High"="3") "2"
^4 Answer On: = Enum("1 Ring"="1","2 Rings"="2","3 Rings"="3","5 Rings"="5","7 Rings"="7") "2"
^5 Fax Identifier: = Text "Stalker_GmbH"
^6 AT for Receive: = Text ""
^7 AT for HW Handshake: = Text ""
^8 AT for SW Handshake: = Text ""
^9 AT for Normal mode: = Text ""
! ------------------------------------------
! Resetting the modem:
! ------------------------------------------
@Hangup
SerReset 19200,0,8,1
SetTries 2
Flush
HsReset 0,0,17,19,0,0
!
! Try to catch the "OK" answer, use the Escape seq and DTR transitions
! to enter the command mode
!
@Label 1
matchclr
matchstr 1 2 "OK\r\n"
write "ATH0&F\r"
matchread 20
Write "+++"
DtrClear
pause 10
DtrSet
!
DecTries
IfTries 0 1
!
! OSErr -6019 "Modem error - the modem is not responding"
!
exit -6019
@Label 2
write "AT+FCLASS=0\r"
Jsr 100
write "AT+FAA=0\r"
Jsr 100
exit 0
! ------------------------------------------
! Receiving incoming calls
! ------------------------------------------
@ANSWER
SetVar A ""
IfStr A 50 "^6^7^8^9"
@Label 10
SerReset 19200,0,8,1
Jsr 80
!
! Set the common options
Jsr 70
!
! Set the communication options:
! • ^6 for receive mode (disable MNP), <DCE Speed>/ARQ message
! • ^7 HW flow control
!!
Write "AT^7^6\r"
Jsr 100
!
! Set Fax parameters: LID, DCC,BOR
!
Write "AT+FCLASS=2\r"
Jsr 100
Write "AT+FLID=\"^5\"\r"
Jsr 100
Write "AT+FDCC=1,3,0,2,0,0,0,0\r"
Jsr 100
Write "AT+FBOR=1\r"
Jsr 100
!
! Allow modem to receive fax messages
!
Write "AT+FCR=1\r"
Jsr 100
!
! Tell the modem to determine the type of the incoming call
! Fetch the tube after ^4 rings
!
Write "ATS0=^4+FAA=1\r"
Jsr 100
Note "Waiting for Fax/ARA/Data calls…"
!
! Everything is ready - let's sit and wait for a call
! We'll wait for 2 minutes, then reinitiate the modem
!
@Label 12
MatchClr
matchstr 1 13 "RING\r\n"
matchstr 2 21 "\r\nCONNECT ^$/ARQ"
matchstr 3 15 "\r\nCONNECT ^$\r\n"
matchstr 9 40 "\r\n+FCON"
matchstr 10 10 "\r\nNO "
matchstr 11 10 "\r\nBUSY"
Matchread 1200
Jump 10
@Label 13
Note "Ring…"
Jump 12
!
! Data connection has been established (we read "CONNECT XXX\r\n")
! Put the "CONNECT" back to the buffer and attach the "Data" subPort
! if it was an incoming call, put the "RING" before the "CONNECT"
!
@Label 15
SetVar A "^$"
Note "Non-V.42 Call at ^A bps. Waiting for an ARA frame."
MatchClr
MatchStr 1 20 "\r"
MatchStr 2 30 "\08\01\03\14\04\03\00\08\250\16\03"
MatchRead 40
@Label 20
Note "Non-ARA call"
Flush
Jump 24
!
! V.42 call detected
!
@Label 21
SetVar A "^$"
Note "V.42 Call at ^A bps"
MatchClr
MatchStr 1 24 "\r\n"
MatchRead 5
@Label 24
QueueInput "\r\nRING\r\n\r\nCONNECT ^A\r\n"
@Label 25
Attach "Data" (DTR,Escape,TimeLimit=0)
!
! The ARA (MNP 4) frame detected
!
@Label 30
Note "ARA call at ^A bps."
Flush
QueueInput "\r\nRING\r\n\r\nCARRIER ^A\r\n"
@Label 32
Attach "ARA" (DTR,Escape,TimeLimit=0)
!
! Fax connection has been established (we read "+FCON")
! Put the +FCON back to the buffer,
! if it was an incoming call, put the "RING" before the "+FCON"
! Attach the "Fax" subPort
!
@Label 40
QueueInput "\r\n+FCON"
ifOriginate 41
QueueInput "\r\nRING\r\n"
@Label 41
Attach "Fax" (DTR,Reset,Escape,IdleLimit=30)
! ------------------------------------------
! Originating a call through the "ARA" subport
! ------------------------------------------
@ORIGINATE "ARA"
SerReset 19200,0,8,1
Jsr 80
!
! Set the common options
!
Jsr 70
!
! Set the Data mode:
! • ^9 Normal connection, DCE speed
! • ^7 Hardware handshake
! • S7: time-out (90 sec) for long-distance call (if you use them)
!
Write "AT^7^9\r"
Jsr 100
!
! Prepare to receive all error result codes
!
Jsr 90
MatchStr 1 45 "\r\nCONNECT "
MatchRead 900
Write "\r"
Exit -6019
@Label 45
QueueInput "\r\nCARRIER "
Jump 32
! ------------------------------------------
! Originating a call through the "Data" subport
! ------------------------------------------
@ORIGINATE "Data"
SerReset 19200,0,8,1
Jsr 80
Jsr 70
!
! Now emit all commands that the application has sent to that port
!
Jsr 60
SerReset *
Jsr 80
!
! Prepare to receive all error result codes
!
Flush
Jsr 90
MatchStr 1 48 "^$\r\nCONNECT"
MatchRead 900
Write "\r"
Exit -6019
@Label 48
QueueInput "^$\r\nCONNECT"
Jump 25
! ------------------------------------------
! Originating a call through the "Fax" subPort
! ------------------------------------------
@ORIGINATE "Fax" ("\r\nLineShare Line is Busy\r\nBUSY\r\n")
SerReset 19200,0,8,1
Jsr 80
!
! Set the common options
!
Jsr 70
!
! Set the Fax mode
!
Write "AT^8+FCLASS=2\r"
Jsr 100
!
! Now emit all commands that the application has sent to that port,
! Prepare to receive all error result codes
!
Jsr 60
Jsr 90
MatchStr 1 40 "\r\n+FCON"
MatchRead 700
Write "\r"
Exit -6019
@Label 50
Note "Suspended"
Say "Press the Option button to enter the AT-strings for your modem!"
Pause 1200
Jump 50
!
! This section emits all modem commands sent from the client application
! For each set of commands the "OK" answer is awaited
!
@Label 60
EmitStart
@Label 61
EmitCommand 62
Jsr 100
Jump 61
@Label 62
return
!
! This section initiates the modem before ANSWER and ORIGINATEs:
! dialtone detect + connect at the highest rate + speaker control +
! hang up on Dtr drop + DCD valid
! Verbal responses mode, no echo
! Disable extended codes
!
@Label 70
Write "ATX4M^2L^3&D2&C1V1E0\r"
Jsr 100
return
!
! This section syncronize the modem after the serial port speed switching
!
@Label 80
ChrDelay 1
Write "AT\r"
ChrDelay 0
Jsr 100
return
!
! Prepare to receive error result codes
!
@Label 90
MatchClr
MatchStr 2 91 "NO DIALTONE\r\n"
MatchStr 3 92 "BUSY\r\n"
MatchStr 4 93 "NO CARRIER\r\n"
MatchStr 5 94 "NO ANSWER\r\n"
Write "ATD^1\r"
HsReset *
return
@Label 91
exit -6020
@Label 92
exit -6022
@Label 93
exit -6021
@Label 94
exit -6023
!
! Processing the AT command:
! OK -> proceed
! ERROR or TimeOut ->exit -6019
! It can be called AFTER the "Write" command, since LineShare buffers input
!
@Label 100
MatchClr
MatchStr 1 102 "\r\nOK\r\n"
MatchStr 2 101 "\r\nERROR\r\n"
MatchRead 20
@Label 101
Exit -6019
@Label 102
return